package com.example.springboot_jdk8.service.impl;

import cn.hutool.json.JSONArray;
import com.example.springboot_jdk8.entity.MdmOrg;
import com.example.springboot_jdk8.enums.PullDataConfigEnum;
import com.example.springboot_jdk8.service.AbsConvertOrgData;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 全量数据转换
 */
@Slf4j
@Service
public class FullOrgDataConvertImpl extends AbsConvertOrgData<MdmOrg> {
//    @Autowired
//    private MdmOrgServiceImpl mdmOrgService;


    @Override
    public Boolean supportConvertDataType(PullDataConfigEnum pullDataConfigEnum) {
        return pullDataConfigEnum.equals(PullDataConfigEnum.ORG);
    }

    @Override
    public Boolean supportConvertDataModel(PullDataConfigEnum pullDataConfigEnum) {
        return pullDataConfigEnum.equals(PullDataConfigEnum.FULL);
    }


    /**
     * 具体实现转换
     * @param subOrgList
     * @return
     */
    @Override
    public List<MdmOrg> convertOrg0(JSONArray subOrgList) {
        log.info("FullOrgDataConvertImpl  convertOrg0....");
        MdmOrg mdmOrg = new MdmOrg();
        mdmOrg.setFatherOrg("ffffffffff");
        mdmOrg.setOrgName("哈哈哈哈");
        mdmOrg.setLevel(1);
        return Arrays.asList(mdmOrg);
    }
}
